<template>
	<view class="example">
		<text class="title">数据搜索</text>
		<ifun-tree-picker filterable :value="value" clearable checkStrictly lazy :load="handleLoad" :data="treeData" @ok="handleConfirm">

		</ifun-tree-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value:{value:'02001'},
				treeData: [{
						label: "北京",
						value: "01",
						children: [{
							label: "北京",
							value: "01001",
							children: [{
									label: "北京城西",
									value: "01001001",
								},
								{
									label: "北京城东",
									value: "01001002",
								}
							]
						}]
					},
					{
						label: "江苏",
						value: "02",
						children: [{
								label: "南京",
								value: "02001",
							},
							{
								label: "南通",
								value: "02002",
								children: [{
										label: "南通城西",
										value: "02002001",
									},
									{
										label: "南通城东",
										value: "02002003",
									},
									{
										label: "南通城北",
										value: "02002004",
									},
									{
										label: "南通城南",
										value: "02002005",
									}
								]
							}
						]
					},
				]
			}
		},
		methods:{
			handleLoad(info,arr,fn){
				console.log(info,arr);
				
				let data = [
					{
						label: "测试懒加载",
						value: "懒加载001",
					},
					{
						label: "测试懒加载",
						value: "懒加载002",
					}
				]
				if(info.value !='02001'){
					data = [];
				}
				fn(data);
			},
			handleConfirm(node,nodes){
				console.log(node,nodes)
			}
		}
	}
</script>

<style>
</style>